home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / uobj.com / UOBJ.DOC < prev    next >
Encoding:
Text File  |  1990-01-11  |  3.4 KB  |  92 lines

  1. UOBJ Unit                        Version 1.0                         90/01/10
  2. ---------                        -----------                         --------
  3.  
  4.    This Pascal unit contains the TObj class and was written to:
  5.  
  6.      1) provide a "better" base object to Turbo Pascal programmers
  7.      2) enhance portability between Object Pascal and Turbo Pascal (MS/DOS)
  8.      3) provide the standard base object to Quick Pascal programmers
  9.  
  10.    Author: Mike Babulic                   Compuserve: 72307,314
  11.            3827 Charleswood Dr. N.W.
  12.            Calgary, Alberta
  13.            Canada
  14.            T2L 2C7
  15.  
  16.  
  17. CONTENTS
  18. --------
  19.  
  20.   UOBJ.DOC - Documentation for this package.  The document you are reading.
  21.  
  22.   UOBJ.P   - Object Pascal version of the UObj unit. (Macintosh Think Pascal)
  23.   UOBJ.PAS - Turbo Pascal version of the UObj unit.
  24.   UOBJ.QP  - Quick Pascal version of the UObj unit.
  25.  
  26.   TEST.PAS - Turbo Pascal example program.
  27.   TEST.QP  - Quick Pascal example program.
  28.  
  29.  
  30.   NB.  - If you are using Quick Pascal:   RENAME *.PAS *.TP
  31.   ---                                     RENAME *.QP  *.PAS
  32.          so that the debugger won't get confused
  33.  
  34.  
  35. DISCUSSION
  36. ----------
  37.  
  38.    Object Pascal was jointly developed by N. Wirth and Apple Computer.
  39.    The standard root class is called TObject. It contains 2 very useful
  40.    methods:
  41.  
  42.       function Clone:TObject   -- creates a copy of SELF
  43.  
  44.       procedure Free           -- is a high level "dispose", customized for
  45.                                   a particular class. It may, for example,
  46.                                   dispose of storage that is pointed to by
  47.                                   some fields before disposing of SELF
  48.  
  49.    Turbo Pascal's class library doesn't contain this standard and useful
  50.    object. A TObject equivalent would simplify porting programs to and from
  51.    Object Pascal.
  52.  
  53.    Quick Pascal comes with no class libraries at all, so even though it is
  54.    virtually the same as Object Pascal, there is no TObject class.
  55.    Portability is compromised once again.
  56.  
  57.    Turbo Pascal's C++ heritage means that there are significant differences
  58.    between it and Object Pascal; most notable is that a run-time binding
  59.    is done explicitly with a "constructor" method (Run-time binding is
  60.    automatic in Object Pascal).
  61.  
  62.       constructor Bind;        -- performs run-time binding of a variable
  63.                                   to its class. "New(o,Bind)" in Turbo Pascal
  64.                                   is equivalent to "New(o)" in Object Pascal.
  65.  
  66.    "SizeOf" works differently in Turbo and Object Pascal.
  67.  
  68.       function Bytes:Longint;  -- returns the number of bytes used to store
  69.                                   an instance of an object
  70.  
  71.    There is no "TypeOf" function in Object Pascal.
  72.  
  73.       function TypeOf:ClassId; -- returns a value representing the class of
  74.                                   an instance variable.
  75.  
  76.  
  77. GLOSSARY
  78. --------
  79.  
  80.   Class - "object" type
  81.  
  82.   Heap - An area of memory reserved for the dynamic allocation of variables
  83.  
  84.   Instance of a Class - See "Instance of an Object"
  85.  
  86.   Instance of an Object - the place in memory where the fields of an
  87.           Instance Variable are stored
  88.  
  89.   Instance Variable - an "object" variable
  90.  
  91.   Object Pascal - an extension of the Pascal language. Developed by N. Wirth
  92.           and Apple for object oriented programming